00001 // Emacs Mode Line: -*- Mode:c++;-*- 00002 // ------------------------------------------------------------- 00003 /* 00004 * Copyright (c) 2013 Battelle Memorial Institute 00005 * Licensed under modified BSD License. A copy of this license can be found 00006 * in the LICENSE file in the top level directory of this distribution. 00007 */ 00008 // ------------------------------------------------------------- 00009 /** 00010 * @file basic_linear_matrix_solver_implementation.hpp 00011 * @author William A. Perkins 00012 * @date 2015-03-06 12:17:58 d3g096 00013 * 00014 * @brief 00015 * 00016 * 00017 */ 00018 // ------------------------------------------------------------- 00019 00020 #ifndef _basic_linear_matrix_solver_implementation_hpp_ 00021 #define _basic_linear_matrix_solver_implementation_hpp_ 00022 00023 #include "linear_solver.hpp" 00024 #include "linear_matrix_solver_implementation.hpp" 00025 00026 namespace gridpack { 00027 namespace math { 00028 00029 // ------------------------------------------------------------- 00030 // class BasicLinearMatrixSolverImplementation 00031 // ------------------------------------------------------------- 00032 /// 00033 template <typename T, typename I = int> 00034 class BasicLinearMatrixSolverImplementation 00035 : public LinearMatrixSolverImplementation<T, I> 00036 { 00037 public: 00038 00039 typedef typename BaseLinearMatrixSolverInterface<T, I>::MatrixType MatrixType; 00040 00041 /// Default constructor. 00042 BasicLinearMatrixSolverImplementation(MatrixType& A) 00043 : LinearMatrixSolverImplementation<T, I>(A), 00044 p_solver(A) 00045 { 00046 } 00047 00048 00049 /// Destructor 00050 ~BasicLinearMatrixSolverImplementation(void) 00051 {} 00052 00053 protected: 00054 00055 /// The linear solver instance used for this 00056 LinearSolverT<T, I> p_solver; 00057 00058 /// Solve w/ the specified RHS Matrix (specialized) 00059 MatrixType *p_solve(const MatrixType& B) const 00060 { 00061 return p_solver.solve(B); 00062 } 00063 00064 /// Specialized way to configure from property tree 00065 void p_configure(utility::Configuration::CursorPtr props) 00066 { 00067 p_solver.configure(props); 00068 } 00069 00070 }; 00071 00072 00073 } // namespace math 00074 } // namespace gridpack 00075 #endif